/**
 * 
 */
package com.nari.sink.utils;

import java.util.Date;

import com.nari.platform.date.CalendarUtils;
import com.nari.platform.security.SignaturerUtil;


/**
 * 散热器型号字典的编号生成器
 * @author Xiaopeng
 * @date 2014-4-15
 */
public class DictSeriousGenerator {
	
	/**
	 * 根据散热器特征信息生成型号字典的编号
	 * @param sinkType
	 * @param brand
	 * @param sinkCenDis
	 * @throws Exception
	 * @author Xiaopeng
	 * @date 2014-4-15
	 */
	public synchronized static String generateSeriousUID(String sinkType, String brand, 
			double sinkCenDis) throws Exception {
		//根据特征信息生成关键字摘要
		StringBuffer keywords = new StringBuffer("");
		if(sinkType != null) {
			keywords.append(sinkType.trim());
		}
		if(brand != null) {
			keywords.append(brand.trim());
		}
		String keywordsSignature = SignaturerUtil.signatureKeywords(keywords.toString(), 10);
		//时间戳
		String timestamp = CalendarUtils.parseDateToString(new Date(), "yyMMddHHmmss");
		//中心距特征值
		String calPowerMark = Integer.valueOf(Double.valueOf(sinkCenDis).intValue()).toString();
		//构造型号字典编号
		String dictSerious = "SH" + keywordsSignature 
				+ "T" + timestamp 
				+ "C" + calPowerMark;
		return dictSerious;
	}
	
}
